package com.topc.base.constant;

/**
 * @Description: 权限相关常量定义
 * @author: peng.ni
 * @date: 2021/04/07
 */
public interface AuthConstant {

    /**
     * JWT存储权限前缀
     */
    String AUTHORITY_PREFIX = "ROLE_";

    /**
     * JWT存储权限属性
     */
    String AUTHORITY_CLAIM_NAME = "authorities";


    String ADMIN_CLIENT_ID = "admin-app";


    String PORTAL_CLIENT_ID = "portal-app";

    /**
     * 后台管理接口路径匹配
     */
    String ADMIN_URL_PATTERN = "/admin/**";

    /**
     * Redis缓存权限规则key
     */
    String RESOURCE_ROLES_MAP_KEY = "auth:resourceRolesMap";

    /**
     * 认证信息Http请求头
     */
    String JWT_TOKEN_HEADER = "Authorization";

    /**
     * JWT令牌前缀
     */
    String JWT_TOKEN_PREFIX = "Bearer ";

    /**
     * 用户信息Http请求头
     */
    String USER_TOKEN_HEADER = "user";

    String EML_LOGIN_TYPE_STRING = "email";

    String WECHAT_LOGIN_TYPE_STRING = "wechat";

    String PWD_LOGIN_TYPE_STRING = "password";

    /**
     * 登录类型标识：邮箱登录
     */
    String EML_LOGIN_TYPE_PREFIX = "email_";

    String EML_AUTH_CODE_KEY_PREFIX = "email:authCode:";

    /**
     * 登录类型标识：验证码登录
     */
    String WECHAT_LOGIN_TYPE_PREFIX = "wechat_";

    /**
     * Redis缓存短信验证码key前缀
     */
    String WECHAT_AUTH_CODE_KEY_PREFIX = "wechat:authCode:";

    Integer ROLE_TYPE_ADMIN = 1;

    Integer ROLE_TYPE_USER = 2;

}
